'''
   #医疗诊疗对话意图识别挑战赛#
           Request-Symptom
           Inform-Symptom
           Request-Etiology
           Inform-Etiology
           Request-Basic_Information
           Inform-Basic_Information
           Request-Existing_Examination_and_Treatment
           Inform-Existing_Examination_and_Treatment
           Request-Drug_Recommendation
           Inform-Drug_Recommendation
           Request-Medical_Advice
           Inform-Medical_Advice
           Request-Precautions
           Inform-Precautions
           Diagnose
           Other
   '''
import json
with open(r"C:\Users\27437\Desktop\医疗对话分析\IMCS-DAC\IMCS-DAC_test.json",'r',encoding='utf-8') as f:
        train_file=json.load(f)
        key=[i for i in train_file]
        value = [train_file[i] for i in key]
        sentences = [dict_simple["sentence"] for list_simple in value for dict_simple in list_simple]
        dialogue_acts=[dict_simple["dialogue_act"] for list_simple in value for dict_simple in list_simple]

with open('test_dataset.txt','w',encoding='utf-8') as f:
    for train_data in sentences:
        f.write(train_data+'\n')
# 创建一个空字典
action_dict = {}
# 定义一个列表来保存所有的动作类型
actions = [
    "Request-Symptom",
    "Inform-Symptom",
    "Request-Etiology",
    "Inform-Etiology",
    "Request-Basic_Information",
    "Inform-Basic_Information",
    "Request-Existing_Examination_and_Treatment",
    "Inform-Existing_Examination_and_Treatment",
    "Request-Drug_Recommendation",
    "Inform-Drug_Recommendation",
    "Request-Medical_Advice",
    "Inform-Medical_Advice",
    "Request-Precautions",
    "Inform-Precautions",
    "Diagnose",
    "Other"
]

# 遍历列表，将每个动作类型作为键，索引作为值（从0开始）
for index, action in enumerate(actions):
    action_dict[action] = index

#
# with open('dev_label.txt','w',encoding='utf-8') as f:
#     for train_data in dialogue_acts:
#         f.write(train_data+"\n")







